package com.gem.day12.homework;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Order {
	private String gnameString;
	private double price;
	private int num;
	private Date orderTime;
	private double sumPrice;

	public String getGnameString() {
		return gnameString;
	}

	public void setGnameString(String gnameString) {
		this.gnameString = gnameString;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public int getNum() {
		return num;
	}

	public void setNum(int num) {
		this.num = num;
	}

	public Order(String gnameString, double price, int num) {
		super();
		this.gnameString = gnameString;
		this.price = price;
		this.num = num;
		this.orderTime = new Date();
		this.sumPrice = this.price * this.num;
	}

	public Date getOrderTime() {
		return orderTime;
	}

	public void setOrderTime(Date orderTime) {
		this.orderTime = orderTime;
	}

	public double getSumPrice() {
		return sumPrice;
	}

	public void setSumPrice(double sumPrice) {
		this.sumPrice = sumPrice;
	}

	public Order() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	public String toString() {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		return gnameString + "\t" + price + "\t" + num + "\t" + sumPrice + "\t" + dateFormat.format(orderTime);
	}

}
